﻿using Basic.FlowCollect;
using Basic.FlowLocalEvent.Model;
using WeDonekRpc.Client.Attr;
using WeDonekRpc.Client.Interface;

namespace Basic.FlowLocalEvent.FlowNode
{
    [LocalEventName("Delete")]
    internal class ClearNodeMsg : IEventHandler<FlowNodeEvent>
    {
        private readonly INodeMsgCollect _NodeMsg;

        public ClearNodeMsg ( INodeMsgCollect nodeEvent )
        {
            this._NodeMsg = nodeEvent;
        }

        public void HandleEvent ( FlowNodeEvent data, string eventName )
        {
            if ( data.Node.NodeType != FlowRemoteModel.FlowNodeType.结束节点 )
            {
                this._NodeMsg.Clear(data.Node.FlowId, data.Node.Id);
            }
        }
    }
}
